import pandas as pd
import xlrd
import  matplotlib.pyplot as plt

#导入数据
df = pd.read_excel('D:/dataset/score.xls',header=0)

groups = df.groupby('期末考试')
x = groups.size().index
y = groups.size().values
print(x)
print(y)

plt.rcParams['font.sans-serif'] = ['SimHei']
plt.rcParams['axes.unicode_minus'] = False

plt.figure(figsize=(8,4))

plt.bar(x,y,width=1,color='blue',edgecolor='white')

plt.xlabel("成绩区间")
plt.ylabel("人数")

plt.suptitle("期末综合成绩分布")
plt.show()

